﻿@namespace BootstrapBlazor.Components
@typeparam TValue
@inherits ValidateBase<TValue>

@if (IsShowLabel)
{
    <BootstrapLabel required="@Required" for="@Id" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
}
@if(InputGroup == null)
{
    @RenderCheckbox
}
else
{
    <div class="form-control">
        @RenderCheckbox
    </div>
}

@code {
    RenderFragment RenderCheckbox =>
    @<div @attributes="AdditionalAttributes" class="@ClassString">
        <input class="@InputClassString" type="checkbox" id="@Id" disabled="@Disabled" checked="@CheckedString" data-bb-stop-propagation="@StopPropagationString" />
        @if (IsShowAfterLabel)
        {
            @RenderLabel
        }
    </div>;

    RenderFragment RenderLabel =>
    @<label class="form-check-label" for="@Id">
        @if(ShowLabelTooltip is true)
        {
            <Tooltip Title="@DisplayText">
                @DisplayText
            </Tooltip>
        }
        else
        {
            @DisplayText
        }
    </label>;
}
